package com.googlecode.sere.connectors

import javax.servlet._
import javax.servlet.http._
import com.googlecode.sere.http._
import com.googlecode.sere.util.Logging

class ServletConnector extends HttpServlet with Logging {
	
	override def init() {
    logger.info("Inicializing Ramon Servlet Connector")
  }
  
	override def service(req: HttpServletRequest, res: HttpServletResponse) {
		logger.info("Received request from {}", req.getRemoteAddr)
		val request = new ServletHttpRequest(req)
		val response = new ServletHttpResponse(res)
		RestEngine.process(request, response)
	}

	override def destroy {
    logger.info("Ramón Servlet Connector finalized")
  }
}